package com.keyingbo.leran.spring.framkwork.webmvc.support;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: KEYB
 * @Date: 2019-4-18 16:56
 * @Description:
 */
public class CaseStringContext {
    private final static Map<Class,CaseStringStrategy> map = new HashMap<Class, CaseStringStrategy>(2);

    public static Object doCase(Class clazz,String object){
        CaseStringStrategy caseStringStrategy = map.get(clazz);
        if (caseStringStrategy != null){
            return caseStringStrategy.caseString(object);
        }
        return object;
    }

    static {
        map.put(Integer.class,new CaseStringToInteger());
        map.put(Double.class,new CaseStringToDouble());
    }
}
